package com.bz.xtcx.manager.mapper;

import com.bz.xtcx.manager.entity.IndexVisiter;
import com.bz.xtcx.manager.mapper.provider.IndexVisiterProvider;
import com.bz.xtcx.manager.persist.conditions.IndexVisiterCondition;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface IndexVisiterMapper {

    @InsertProvider(type = IndexVisiterProvider.class, method = "insertSelectiveProvider")
    int insertSelective(IndexVisiter record);

    @SelectProvider(type = IndexVisiterProvider.class, method = "selectByConditionProvider")
    @Results(
            id = "indexVisiterRow",
            value = {
                    @Result(property = "recCount", column = "rec_count"),
                    @Result(property = "id", column = "id"),
                    @Result(property = "ip", column = "ip"),
                    @Result(property = "visitTime", column = "visit_time")
            }
    )
    List<IndexVisiter> selectByCondition(IndexVisiterCondition ivc);

    @SelectProvider(type = IndexVisiterProvider.class, method = "countByConditionProvider")
    int countByCondition(IndexVisiterCondition ivc);

    @SelectProvider(type = IndexVisiterProvider.class, method = "countWithIpByConditionProvider")
    @ResultMap(value = "indexVisiterRow")
    List<IndexVisiter> countWithIpByCondition(IndexVisiterCondition ivc);

    @SelectProvider(type = IndexVisiterProvider.class, method = "countWithIpAndDayByConditionProvider")
    @ResultMap(value = "indexVisiterRow")
    List<IndexVisiter> countWithIpAndDayByCondition(IndexVisiterCondition ivc);
}